<html>
  <head>
    <title>TU Recipes - Recipe List</title>
    <%= stylesheet_link_tag 'scaffold'   %>
  </head>
  <body>
<% if session[:is_admin] == true %>
    <p>Logged in: <%= session[:logged_in] %></p>
    <p>User ID:  <%= session[:user_id] %></p>
    <p>Username:  <%= session[:user_name] %></p>
    <p>Is admin?  <%= session[:is_admin]  %></p>
<%  end %>
<% if session[:logged_in] == 0 %>
<h2>Log in to access more features!</h2>
<% end %>
<h1>Recipe List</h1>
<div id='header-inner'>
  <% for rec_media in @recipemedia %>
   
        <div id='main-wrapper'>
        <h2 class='date-header'> <%=h rec_media.rmedia.title %></h2>
      <h3 class='post-title'>
        Category: <%=h rec_media.rmedia.category %>
      </h3>

        <div class='post-body'> Descriptions:
<%=h rec_media.rmedia.directions %><br></br>
<%=h rec_media.rmedia.description %><br></br>
<% for ing in rec_media.rmedia.ingredient %>
      <%=h ing.name %>
      <br/>
      <% end %>
    </div>
    <div class='post-footer'>
    <p class='post-footer-line post-footer-line-1'>
      <span class='post-author'>
        Created by: <%=h rec_media.created_user %> <br></br>
      </span>
      <span class='post-timestamp'>
         Created at: <%=h rec_media.created_at %>
      </span> </p>
<%= link_to 'View', :controller=>"recipe", :id=>rec_media, :action => "view" %> &nbsp;
    <% if session[:logged_in] == 1 %>
      <%= link_to 'Edit', :controller=>"recipe", :id=>rec_media, :action => "update" %>&nbsp;
      <%= link_to 'Destroy', :controller=>"recipe", :id=>rec_media, :action => "destroy" %>&nbsp;
      <% if session[:logged_in] == 1 %>
<%= link_to 'New Recipe', :controller=>"recipe", :action=>"new" %>
<% end %>
<% if session[:is_admin] == true %>
<%= link_to 'Test Recipe', :controller=>"recipe", :action=>"testnew" %>
<% end %>
    <% end %>
    </div>
  </div> <% end %>
</div>


<%#*<table border="1">%>
  <%#*<tr>%>
    <%#*<th>Created by</th>%>
    <%#*<th>Created at</th>%>
    <%#*<th>Title</th>%>
    <%#*<th>Category</th>%>
    <%#*<th>Directions</th>%>
    <%#*<th>Description</th>%>
    <%#*<th>Ingredients</th>%>
  <%#*</tr>%>


  <%#*<tr>%>
    <%#*<td></td>%>
    <%#*<td></td>%>
    <%#*<td></td>%>
    <%#*<td></td>%>
    <%#*<td></td>%>
    <%#*<td></td>%> 

<br />


  </body>
</html>
